
<div class="alignleft" id="sidebar">
	<div class="actions">
	<?php if(($this->Session->read('Auth.User')) && $this->Session->read('Auth.User.id') == $user['User']['id']): ?>
		<ul>
			<li><?php echo $this->Html->link(__('Edit Profile', true), array('action' => 'edit', $user['User']['id'])); ?> </li>
			<li><?php echo $this->Html->link(__('Delete Account', true), array('action' => 'delete', $user['User']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?> </li>
			<!-- <li><?php echo $this->Html->link(__('List Users', true), array('action' => 'index')); ?> </li>
			<li><?php echo $this->Html->link(__('New User', true), array('action' => 'add')); ?> </li>
			<li><?php echo $this->Html->link(__('List Tasks', true), array('controller' => 'tasks', 'action' => 'index')); ?> </li>
			<li><?php echo $this->Html->link(__('New Task', true), array('controller' => 'tasks', 'action' => 'add')); ?> </li> -->
		</ul>
	<?php else:
		echo $this->Html->para(null, 'Bugs or Hugs? Email us: '.$html->link('contact@inspiritblog.com', 'mailto:contact@inspiritblog.com'));
	endif; ?>
	</div>
</div>
<!-- /Sidebar -->

<div class="alignleft" id="main">
	<div class="users view">
	<?php if(($this->Session->read('Auth.User')) && $this->Session->read('Auth.User.id') == $user['User']['id']): ?>
		<div class="alignright">
			<div class="actions">
				<ul>
					<li><?php echo $this->Html->link(__('New Task', true), array('controller' => 'tasks', 'action' => 'add'));?> </li>
				</ul>
			</div>
		</div>
		<?php endif; ?>
		<?php if(($this->Session->read('Auth.User')) && $this->Session->read('Auth.User.oauth_uid')):
			echo "<img class=\"alignleft\" src=\"https://graph.facebook.com/".$user['User']['oauth_uid']."/picture\"/>";
			endif;
		?>
		<h2><?php if(($this->Session->read('Auth.User')) && $this->Session->read('Auth.User.id') == $user['User']['id']){
			__('Hello, ');
		} echo $user['User']['name']; ?> </h2>

		<?php echo '<small>'.$user['User']['email'].'</small>'; ?>

	<hr class="clear" /><br />
	<div class="related">
	<h4><?php if(($this->Session->read('Auth.User')) && $this->Session->read('Auth.User.id') == $user['User']['id']):
		__('Your tasks');
	else:
		__('Their tasks');
	endif;
	?></h4>
	<?php if (!empty($user['Task'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
<!--		<th><?php __('Id'); ?></th>
		<th><?php __('User Id'); ?></th> -->
		<th><strong><?php __('Title'); ?></strong></th>
<!--		<th><?php __('Created'); ?></th>
		<th><?php __('Modified'); ?></th> -->
		<th><strong><?php __('Complete On'); ?></strong></th>
<!--		<th><?php __('Completed On'); ?></th> -->

	<?php if(($this->Session->read('Auth.User')) && $this->Session->read('Auth.User.id') == $user['User']['id']): ?>
		<th class="actions"><strong><?php __('Actions');?></strong></th>
	<?php endif; ?>
	
	</tr>
	<?php
		$i = 0;
		foreach ($user['Task'] as $task):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
<!--			<td><?php echo $task['id'];?></td>
			<td><?php echo $task['user_id'];?></td> -->
			<td><?php echo ucfirst($task['title']);?></td>
<!--			<td><?php echo $task['created'];?></td>
			<td><?php echo $task['modified'];?></td> -->
			<td><?php echo $task['complete_on'];?></td>
<!--			<td><?php echo $task['completed_on'];?></td> -->
		<?php if(($this->Session->read('Auth.User')) && $this->Session->read('Auth.User.id') == $user['User']['id']): ?>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'tasks', 'action' => 'view', $task['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'tasks', 'action' => 'edit', $task['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'tasks', 'action' => 'delete', $task['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $task['id'])); ?>
			</td>
		<?php endif; ?>
		</tr>
	<?php endforeach; ?>
	</table>
<?php else: __('No tasks yet!'); if(($this->Session->read('Auth.User')) && $this->Session->read('Auth.User.id') == $user['User']['id']): __(' Add one.'); endif; endif; ?>
</div>
	</div>
	<!-- /View -->
</div>
<!-- /Main -->
